# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html

import json
import codecs

class FrspiderPipeline(object):

    def __init__(self):
        self.filename = codecs.open("frxxz.json", "w", encoding="utf-8")
        # self.filename = open("frxxz.json", "w")

    def process_item(self, item, spider):

        content = json.dumps(dict(item), ensure_ascii=False) + ",\r\n"
        self.filename.write(content)
        return item

    def spider_closed(self, spider):
        self.filename.close()


